import crypto from 'crypto'

function createHash (algorithm, data) {
  let engine = crypto.createHash(algorithm)
  engine.update(data)
  return engine.digest()
}

export function generate (pwd) {
  const h = createHash('sha256', pwd)
  return h.toString('base64')
}
